import java.util.Scanner;

public class Shuixianhua {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入一个三位数：");
        int number = scanner.nextInt();

        int sum = 0;
        for (int i = 100; i <= number; i++) {
            int gewei = i % 10;
            int shiwei = i / 10 % 10;
            int baiwei = i / 100;
            if(i == gewei*gewei*gewei + shiwei*shiwei*shiwei + baiwei*baiwei*baiwei){
                System.out.println(i);
            }
        }
    }
}
